﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using WDA.Config;

namespace WDA.Core
{
	/// <summary>
	/// Defines interface of WDAB runtime component module. Modules are mostly responsible for creating so-called
	/// service controllers (lower level components responsible for establishing communication channels).
	/// </summary>
	public interface IModule : IDisposable
	{
		/// <summary>
		/// Initializes module configuration.
		/// </summary>
		/// <param name="outerContainer">Outer (configuring) Unity container.</param>
		/// <param name="localContainer">Local (runtime-level) Unity container.</param>
		/// <param name="persistentContainer">Persistent (<see cref="Services"/> class-level) Unity container.</param>
		/// <param name="configName">WDAB active configuration name.</param>
		/// <param name="hostName">WDAB host name.</param>
		void Init(IUnityContainer outerContainer, IUnityContainer localContainer, IUnityContainer persistentContainer, string configName, string hostName);
		/// <summary>
		/// Creates service controller instances for provided configuration.
		/// </summary>
		/// <param name="config">WDAB configuration source.</param>
		/// <param name="serviceControllers">Collection of service controllers keyed by contract type.</param>
		void CreateServiceControllers(IConfiguration config, Dictionary<Type, IServiceController> serviceControllers);
	}
}
